package com.tchhy.provider.connect

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

object MessageParser {

    fun <T> parse(message: String): T? {
        try {
            val type = object : TypeToken<T>() {}.type
            return Gson().fromJson<T>(message, type)
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return null
    }
}